import chai, {expect} from 'chai';
import {ethers, network} from 'hardhat';
import {solidity} from 'ethereum-waffle';
import {BigNumber, ContractFactory, Contract, utils, Event} from 'ethers';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/dist/src/signer-with-address';
import pino from 'pino';
import { MonkeyKing } from '../src/types/MonkeyKing';

chai.use(solidity);
const Logger = pino();



describe('cellEvolution with Proxy', () => {
    let operator: SignerWithAddress;
    let accountA: SignerWithAddress;

    before('setup accounts', async () => {
        [operator, accountA] = await ethers.getSigners();
      });

      describe('test base Information', () => {
        let Monkeyking: MonkeyKing ;

        // let Monkeyking;
        let MonkeyKing_Factory: ContractFactory;
        let ArrtibuteAssertFactory : Contract
        let ArrtibuteAssertFactory_Factory :ContractFactory

        beforeEach('deploy  contract',async() => {
            Logger.info('deploy MonkeyKing ');
            MonkeyKing_Factory = await ethers.getContractFactory("MonkeyKing");
            // Monkeyking = await MonkeyKing_Factory.connect(operator).deploy();
            Monkeyking = (await MonkeyKing_Factory.connect(operator).deploy(10,"MonkeyKing","MKK")) as MonkeyKing;
            Logger.info(`Monkeyking deployed at ${Monkeyking.address}`);

            ArrtibuteAssertFactory_Factory = await ethers.getContractFactory("ArrtibuteAssertFactory");
            ArrtibuteAssertFactory = await ArrtibuteAssertFactory_Factory.connect(operator).deploy(0);
            Logger.info(`ArrtibuteFactory deployed at ${ArrtibuteAssertFactory.address}`);
            
        });

        it(' init Factory ', async () => {
          let faddr :string =  ArrtibuteAssertFactory.address;
          // let addrs :string[] = [faddr,faddr,faddr,faddr,faddr,faddr];
          Logger.info(`Monkeyking  at ${Monkeyking.address}`);
          await Monkeyking.newArrtibutesFactorys();
          Logger.info(`ArrtibuteFactory Factorys ${await Monkeyking.getArrtibutesFactory()}`);
          
        });

      });
});